
def add(stulist: object, stu: object):
    if search_by_ID(stulist, stu.ID ) is True:
        print( '此ID已存在' )
        return False
    stulist.append( stu )
    choose = input( 'Do you want to save the result?(Y/N)' )
    if choose is 'y' or choose is 'Y':
        file_object = open( 'D:/practice/a.txt', 'a' )
        file_object.write(stu.ID )
        file_object.write( ' ' )
        file_object.write( stu.name )
        file_object.write( ' ' )
        file_object.write(stu.score)
        file_object.write("\r\n")
        return True
    else:
        stulist.remove( stu )
        print( '信息添加失败' )
